package lattice.traveler;

import java.util.ArrayList;

public class SyncedStateCut {
	private ArrayList<Integer> cut = new ArrayList();
	
	public int size() { return cut.size(); }
	
	public int getVid(int sid) { return cut.get(sid); }
	
	public void setVid(int sid, int vid) { cut.set(sid, vid); }
	
	public void addVid(int vid) { cut.add(vid); }
	
	public boolean equals(SyncedStateCut other) {
		for (int i = 0; i < cut.size(); ++i)
			if (getVid(i) != other.getVid(i)) return false;
		return true;
	}
	
	public boolean greater(SyncedStateCut other) {
		for (int i = 0; i < cut.size(); ++i)
			if (getVid(i) <= other.getVid(i)) return false;
		return true;
	}
	
	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		String prefix = new String(",");
		if (cut.size() > 0) sb.append("[" + cut.get(0));
		for (int i = 1; i < cut.size(); ++i) {
			sb.append(prefix);
			sb.append(cut.get(i));
		}
		if (cut.size() > 0) sb.append("]");
		return sb.toString();
	}
}

